Paint 0.9 for Max 6.0
Paint 0.9 for Max 4.0

Source Code

 

    



This pluggin is what I define as charityware and can be freely distributed. If you find it useful make what you feel as an appropriate donation to your favorite charity. You cannot charge or make any money from this routine by reselling or bundling them with another package/cd/web page without my permission.



To install this plugin copy the paintMod.dlm file into your 3ds Max plugin directory, if you have an older version of paintModTablet.dlm you can delete it.

 

Upcoming next

Maybe a few more inks

 

Things that might happen

The ability to record and play back strokes

            Object and bitmap as brushes

            Maybe some scripts to have floating dialogs for the brush controls

 

Things that are not gonna happen

Any type of topology changing inks such as tessellate, edge split, vertex color etc.  These types of changes really slow down the system.  So I might end up doing a mesh only version that do these types of functions but it will be significantly slower.

 

If you have any more wishes for this plugin better send them in soon since I am only going to spend a few more weeks on it.

 

0.99

            Fixes a name conflict with the Freehand Tools script

Changed the internal architecture so inks can now be plugins (NOTE I am not completely happy with the interface right now, so the headers will probably change in a few weeks)

Added 2 new plugin inks Create Spline and Scatter

 

0.98

Fixes a crashes with topology changing modifiers above it such as tesselate and meshsmooth.

Smooth, Move Orig Normal, Select Faces/Verts now only work on mesh objects and will not crash other objects.

Should be more stable with non mesh type objects.

 

0.97

            Dynamically loads the tablet drivers now so you only need one .dlm

            Removed some of the extraneous hit test modes and fields, I now just use the quad tree

            Almost everything is macro recorded and scriptable except the parts of the falloff graph

            Added a Reset Graph button that will allow you to reset the Falloff Graph

            Added a brush list that allows you to store brushes

           

0.95

            Adds instancing support, so you can apply it to multiple objects

            2 New ink types Smoothing and Select Faces

            A display option to turn off the line left behind a brush stroke

 

0.9 More new tools

Added a falloff graph for the brush falloff

Added a mirror options

Smoothed out the deformation some, especially when using high lag values

Changed additive back to the old way

Lag and Update on Mouse up have been changed

Added a scale and move original normal ink types

Minor speed increases

Fixed a bug where the brush would paint on the opposite of the mesh

Fixed some update bugs after undos and reset where the surface did not update

Add a display line behind the brush as you stroke so you can now see the stroke if you are not automatically updating.

Added ability to assign pressure support to size and/or strength

 

 


0.8 Adds a lot experimental features

            Changed the name to just Paint

Faster hit testing and painting

Different hitting testing routines

Added pressure sensitive tablet support

Changed how addative works

Added some display options for the cursor color

Added soft selection

Added keyboard short cuts for resizing the changing the strength.

Single click support

 


0.7 adds a cursor now when you paint and also lets it work with NURBS and patch surfaces.

0.55 adds an overall effects channel

 

Ink Drop Box - this determines the type of ink to use
  Move Normal - moves the painted vertices along their normals

  Move Original Normal – this moves the vertex along the normal of the original mesh face.  This ink only works on mesh objects.
  Scale- this scales the vertex along its current deformation direction.

  Move XY - moves the painted vertices along the screen XY axis system
  Move Z - moves the painted vertices along the screen Z axis system
  Smooth – a simple average smoothing algorithm.  This only works on meshes.  This ink only works on mesh objects.
  Select Verts – allows you to paint soft selection.  This ink only works on mesh objects.
  Select Faces – selects faces.  This ink only works on mesh objects.

  Create Spline – this lets you draw splines on the the surface that you are painting on.

  Scatter – this lets you paint objects along the surface.

 

 

Paint – this put you in paint mode which allows you to apply the ink type to the mesh.  Just hold the mouse button over the object and paint around.  The weight text next to the button will tell you how hard you are pressing if you are using a pressure sensitive tablet.

 

Strength - how strong the brush is, the stronger the brush the stronger the ink, a negative effect forces the effect to go in the opposite direction.  Holding CTRL/SHIFT and mouse dragging will allow you to adjust the Strength in the viewport.

 

Effect Radius - this is how big the brush is. This determines which vertices are affected. The larger the radius the more vertices that will be affected.  Holding ALT/SHIFT and mouse dragging will allow you to adjust the Size in the viewport.

 

Falloff Graph - this is the falloff graph that determines how the weight of the brush will be applied.

 

RG – this will reset the Falloff Graph back to its original default falloff.

 

Brush DropList – this contains a list of all your brushes.  Selecting a brush will set the Ink Type, Strength, Radius, and Falloff for that brush.

 

Add Brush – this will take your current Ink Type, Strength, Radius, and Falloff and add it as a brush to the Brush DropList.  A dialog will pop up prompting you to name the brush.

 

Remove Brush – this will remove the current selected brush from the Brush DropList.

 

Additive - determines if the effect is additive for each stroke. If this is on every time you go over a point in the same paint stroke the ink will be applied. If this off the point will only be moved until it reaches maximum strength.

Total Effect - detereines how much of the effect is applied to the mesh. At 1.0 the effect is applied as normal, at 0.0 there is no effect and at -1.0 the effect is backward. This field is animatable.

Reset Modifier – this will remove any paint strokes that have been applied.

 

 

 



 

These controls allow you turn on and off mirroring and the placement of the mirror plane.

 

Enable Mirror – turns on/off the mirror plane.  When on the brush stroke will be mirrored across the plane.

 

X/Y/Z - is the axis of the mirror plane in object space.

 

Offset – allows you to offset the mirror plane in the direction of the plane normal.

 

Size – is the size of the plane gizmo in the viewport.

 

 

 

 

 

Enable pressure support – enables the pressure sensitive tablet support if you have one.  The pressure affects the strength of the pressure.

   Affect Strength – if this is set, the pressure will affect the strength of the brush.

   Affect Size – if this is set, the pressure will affect the size of the brush.

 

Update on mouse up – when this is on the stroke will updated when the mouse button is let go.  This allows for faster view interaction but you will have to wait for the update.

 

Lag Rate – determines how often mouse is polled, the more the mouse is polled the smoother the stroke but slower your interaction will be.  The higher the number the less often it is polled, but the more like the stroke will become bumpy.

 

Quad Tree – is how deep the quad tree is.  The deeper the quad tree the faster it is during interaction but the more memory it consumes.  If you are getting long pauses after a stroke up you can turn this down to reduce the pause, but interaction might slow down during the stroke.

 

Display Options

Draw Ring – this determines if the ring around the brush is drawn and its color.

Draw Normal – this determines if the normal direction for the brush is drawn and its color.

Draw Pressure – this determines if the pressure marker for the brush is drawn and its color.

Draw Stroke – this determines if the line is drawn behind the stroke.

 

 

 


Maxscript Calls

 

ButtonPaint

            This call is equivalent to pressing the Paint button in the interface.

ButtonResetGraph

            This call is equivalent to pressing the RGutton in the interface.

ButtonAddBrush

            This call is equivalent to pressing the Add Brush in the interface.

ButtonRemoveBrush

            This call is equivalent to pressing the Remove Brush button in the interface.

ButtonReset

            This call is equivalent to pressing the Reset Modifier button in the interface.

 

setBrushByIndex 

index TYPE_INT the index of the brush from the drop list

This sets a brush as active.  Which brush it is set is controlled by the index into the drop list.

 

setBrushByName

            name TYPE_STRING the name of the brush to set as active

            This sets a brush as active, it sets it based on the name of the brush.  Note this is case sensitive.

 

TYPE_INT createBrush

Name TYPE_STRING – the name that you want to use for the new brush

This will create a new brush and add it to the Brush DropList

removeBrush

index TYPE_INT – the index of the brush to delete

This will remove the brush from the drop list based on the index in the list.

 

TYPE_INT numberBrushes

            This will return the number of brushes in the Brush DropList

 

setBrushGraph

index TYPE_INT – the index of the brush

p1 TYPE_POINT2 – the first point of the graph

handle1 TYPE_POINT2 – the out going handle of the first point relative to the p1

p2 TYPE_POINT2 – the second point of the graph

handle2 TYPE_POINT2  - the incoming handling of the second point relative to p2

This will set the first and second points/handles of a brush for the falloff graph.

 

setBrushName

index TYPE_INT – the index of the brush

name TYPE_STRING – the new name to change the brush to

This function allows you to change the name of an existing brush.

 

setBrushStrength

index TYPE_INT – the index of the brush

strength TYPE_FLOAT – the new strength for the brush

This function lets change the strength of a brush

 

setBrushRadius

index TYPE_INT – the index of the brush

radius TYPE_FLOAT – the new radius for the brush

This function lets change the radius of a brush

 

setBrushInk

index TYPE_INT – the index of the brush

ink TYPE_INT – the new ink for the brush.  The ink types are as follows

Normal                         0

Original Normal            1

Scale                            2

Smooth                        3

Z Local                        4

XY Local                     5

Z Screen                      6

XY Screen                   7

Select Verts                  8

Select Faces                 9

 

This function lets change the ink of a brush.  NOTE this is 0 based

 

 

TYPE_STRING getBrushName

index TYPE_INT – the index of the brush

This returns the name of the brush

TYPE_FLOAT getBrushStrength

index TYPE_INT – the index of the brush

This returns the strength of the brush

TYPE_FLOAT getBrushRadius

index TYPE_INT – the index of the brush

This returns the radius of the brush

TYPE_INT getBrushInk, 0, 1,

            index TYPE_INT – the index of the brush

This returns the ink of the brush.    The ink types are as follows

Normal                         0

Original Normal            1

Scale                            2

Smooth                        3

Z Local                        4

XY Local                     5

Z Screen                      6

XY Screen                   7

Select Verts                  8

Select Faces                 9

 


Quick Tutorial

 

1. Create a grid that is 200x200 with 50 width and length segments using the grid primitive ( if you don't have the grid primitive just create a box and delete all but one side of it).

2. Apply the Deform Paint modifier to the grid.

3. Set the ink type drop list to Move Normal, set the Strength to 2.0, and Effect Radius to 30, Hardness at 0, and uncheck the Addative Strength check.

4. Hit the paint button, and in a shaded perspective view click and drag the mouse around the grid and watch the grid deform. Notice that after a while the ink effect no longer works.

5. Hit the Undo button and check the Additive Strength check box, know drag the mouse around the mesh and notice how the effect keeps layering with no limit.

6. Experiment around with different ink types.

 

7. If you maximize the viewport you will get speed improvements since drawing 4 viewports at once is a pretty heavy operation.



Next on the List of Things to Do

More variations of inks such as different axis systems, and blend from another object

A split edge ink tool

Push/Relax ink

Bitmap for brushes

Objects for brushes

Some sort of drag pull system
Maybe an auto tesselate which could tesselate faces once they became to stretched
Stroke recording, be able to graph the size, strength, and ink of a stroke and be able to store and replay the stroke.

 

Note this utility has not been fully tested in a production environment so use at your own risk. If you encounter any problems please contact me at

Peter Watje